package com.briup.recognition.service.impl;

import com.briup.recognition.bean.BaseRole;
import com.briup.recognition.bean.BaseRoleExample;
import com.briup.recognition.dao.BaseRoleMapper;
import com.briup.recognition.service.IBaseRoleService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class BaseRoleServiceImpl implements IBaseRoleService {

    @Resource
    private BaseRoleMapper baseRoleMapper;

    @Override
    public List <BaseRole> query(){
        BaseRoleExample example = new BaseRoleExample();
        //条件

        return baseRoleMapper.selectByExample(example);
    }

    @Override
    public void saveOrUpdate(BaseRole baseRole) {
        if (baseRole.getId()!=null){
            baseRoleMapper.updateByPrimaryKey(baseRole);
        } else {
            baseRoleMapper.insert(baseRole);
        }
    }

    @Override
    public void deleteById(long id) { baseRoleMapper.deleteByPrimaryKey(id);}
}
